﻿using System;
using System.Runtime.InteropServices;
using Tsanie.ShellExt.Definitions;

namespace Tsanie.ShellExt
{
    [Guid("DFB16C44-4FEB-4432-938F-D0318CAF155B")]
    [ComVisible(true)]
    public class ManagerInfoTip : InfoTipHandlerBase
    {
        protected override string OnGetInfoTip(InfoTipOptions options)
        {
            // 自定义接口
            InfoTipBaseProvider provider = Manager.GetInfoTipProvider(this.Ext);
            if (provider != null)
            {
                try
                {
                    return provider.GetInfoTip(this.Filename, options);
                }
                catch (Exception e)
                {
                    Common.OutputError(string.Format("OnGetInfoTip({0})", options), e);
                }
            }
#if DEBUG
            else
            {
                Common.OutputDebugString("OnGetInfoTip():: Can't find the provider... {0}", this.Filename);
            }
#endif
            return null;
        }
    }
}
